package com.cssl.service.impl;

import com.cssl.domain.Dtskeyword;
import com.cssl.domain.dto.DtskeywordDto;
import com.cssl.mapper.DtskeywordMapper;
import com.cssl.service.Dtskeywordservice;
import com.github.pagehelper.Page;
import com.github.pagehelper.PageHelper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

@Service
public class DtskeywordserviceImpl implements Dtskeywordservice {

    @Autowired
    DtskeywordMapper mapper;

    @Override
    public Map findPagekeyword(DtskeywordDto dtskeywordDto) {
            System.out.println("传入" +dtskeywordDto);
            Page page = PageHelper.startPage(dtskeywordDto.getPage(),dtskeywordDto.getLimit());

            List<Dtskeyword> issues=mapper.findPagekeyword(dtskeywordDto);
            System.out.println("查询结果: " + issues); // 打印查询结果
            System.out.println("分页结果: " + page.getResult()); // 打印分页结果
            Map map = new HashMap();
            map.put("list", page.getResult());
            map.put("total", page.getTotal());
            map.put("totalPage", page.getPages());
            map.put("pageNum", page.getPageNum());
            map.put("pageSize", page.getPageSize());
            return map;
    }
    @Override
    public boolean keyworddelete(String ids) {
        return mapper.keyworddelete(ids);
    }


    @Override
    public Integer updatekeyword(Map map) {
        return mapper.updatekeyword(map);
    }

    @Override
    public Integer addkeyword(Map map) {
        return mapper.addkeyword(map);
    }
}
